<template>
  <div>
    <van-tabs v-model="active" color="#3296fa" animated swipeable>
      <van-tab v-for="item in homeList" :key="item.id" :title="item.name">
        <article-list :channels="item"></article-list>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { channelsAPI } from "@/api";
import articleList from "./components/article-list.vue";
export default {
  name: "Home",
  components: { articleList },
  data() {
    return {
      active: 0,
      homeList: [],
    };
  },
  created() {
    this.channel();
  },
  methods: {
    async channel() {
      const res = await channelsAPI();
      this.homeList = res.data.channels;
    },
  },
};
</script>

<style lang="less" scoped>
/deep/.van-tabs__wrap {
  position: fixed;
  top: 0;
  z-index: 1;
  width: 100%;
}
</style>